Cognitive behaviors arise from an interplay between neural activity driven by external stimuli and internal activity patterns or brain states that relect motivation, intention and experience. Historically, neuroscience re- search has focused almost exclusively on stimulus-driven activity, ignoring the impact of internal state. Clearly, to develop theories of cognitive function and to understand psychiatric illnesses, which are disorders of internal state, a new neuroscience must be developed that measures and models both externally and internally generated neural activity and seeks to reveal the interactions between them. Several significant challenges have prevented the study of internal state. First, to analyze experimental data, it is typical to average across many trials. However, if the internal state differs from trial to trial, this procedure will destroy the state-dependent neural responses in data. Second, internal states may differ from each other only by the way that they process information in time, in other words, by their dynamics. Third, to date, the neuroscience field has no insight into how transitions between internal states arise and remain limited to only occur at appropriate times. This application meets these challenges by offering methods for 1) inferring the transition times between states so that state-specific activity can be elucidated; 2) discovering state-dependent dynamics in experimental data; and 3) determining the mechanisms for maintenance of internal state and transitioning between states. The study of internal state will support the basic neuroscience goal of developing circuit level theories neural computation and cognitive function. However, this application also impinges upon two hypotheses for the development of psychiatric disease and thus may lead to new approaches to diagnosis and treatment. First, illness may develop because state-specific computations have gone awry leading to symptoms such as, in the case of schizophrenia, the misidentification of internally generated spontaneous activity as external stimuli (that is, hallucinations). Second, and completely novel, psychiatric phenomena may arise, not from disordered states per se, but rather from disordered state transitions, or transitionopathies. In obsessive-compulsive disorder, for example, a state associated with a compulsion (for example, the need to check that the door is locked) maybe completely nor- mal, but pathology results from the failure to transition appropriately to a new state. The tools presented in this application will permit the comparison of data between healthy animals and disease models, and thus may give insight into how state-specific computations can fail and lead to disease. Additionally, by exploring potential mechanisms by which transitioning may become disordered, this application may offer insight into the development of transitionopathy. While the analysis methods developed in this application will initially be applied to data from animals, in the future they could be extended toward the analysis of noninvasive measures of brain activity in humans such as fMRI or EEG. If a robust theory of normal and abnormal internal states and state transitioning is developed, such analyses could aid in the diagnosis of psychiatric disease.